Problem with Prototype 1.6.1 (& solved)

260 views
Skip to first unread message

Julius Šėporaitis

unread,
Oct 12, 2009, 5:16:13 PM10/12/09
to Prototype & script.aculo.us
Hi,

just wanted to post a quick note for those who maybe had problems like
mine:

- Prototype v.1.6.1
- Firefox 3.5
- JS Error: root.querySelectorAll is not a function (about line 3299
in prototype.js)

This started to happen on Magento checkout pages, where the Accordion
is and I don't know if this is a prototype bug or not, so - I don't
know why and when this happens, but on my situation initially - the
root variable is a string so it passes the initial check (root = root
|| document) causing problems later. :) Here's a solution.

in the prototype.js prepend this line (~3299):

results = $A(root.querySelectorAll(e)).map(Element.extend);

so it looks like this:

if(typeof root == string) root = $(root);
results = $A(root.querySelectorAll(e)).map(Element.extend);

I hope this gets helpful to someone.

Cheers,
Julius Seporaitis

Garfieldius

unread,
Oct 13, 2009, 8:50:47 AM10/13/09
to Prototype & script.aculo.us
For the sake of completeness: you forgot the "

so it's
if(typeof root == "string") root = $(root);

sven...@googlemail.com

unread,
Oct 14, 2009, 3:59:24 AM10/14/09
to Prototype & script.aculo.us
Hi,

i have the same issue with the error but your solution doesnt work for
me. Error keeps the same.

Any more ideas?

Julius Seporaitis

unread,
Oct 14, 2009, 4:20:48 AM10/14/09
to prototype-s...@googlegroups.com
Garfieldius, thanks :)

svens0n82, I've later found that function 'descendant' also needs similar fix. Around line 3597 in prototype.js I've changed:

h.concat(results, node.getElementsByTagName('*'));

into

if(typeof node == 'string') { node = $(node); }
h.concat(results, node.getElementsByTagName('*'));
--
Cheers,
Julius Šėporaitis

Irwan Djoehana

unread,
Nov 9, 2009, 11:06:20 AM11/9/09
to Prototype & script.aculo.us
Thank you very much.
I had the same problem and your fix did work.
Cheers :-)


On 12 oct, 22:16, Julius Šėporaitis <jul...@seporaitis.net> wrote:
> Hi,
>
> just wanted to post a quick note for those who maybe had problems like
> mine:
>
> - Prototype v.1.6.1
> - Firefox 3.5
> - JS Error: root.querySelectorAllis not a function (about line 3299

Irwan Djoehana

unread,
Nov 10, 2009, 4:51:27 AM11/10/09
to Prototype & script.aculo.us
It solved my problem, again.
Thanks!

On 14 oct, 09:20, Julius Seporaitis <jul...@seporaitis.net> wrote:
> Garfieldius, thanks :)
>
> svens0n82, I've later found that function 'descendant' also needs similar
> fix. Around line 3597 in prototype.js I've changed:
>
> h.concat(results, node.getElementsByTagName('*'));
>
> into
>
> if(typeof node == 'string') { node = $(node); }
> h.concat(results, node.getElementsByTagName('*'));
>
> On Wed, Oct 14, 2009 at 10:59 AM, svens0...@googlemail.com <
Reply all
Reply to author
Forward
0 new messages